#ifndef REGISTERDIALOG_H
#define REGISTERDIALOG_H

#include <QDialog>
#include"global.h"
#include<map>
#include <QtQml/qqmlapplicationengine.h>
#include"../tailor.h"

namespace Ui {
class RegisterDialog;
}

class RegisterDialog : public QDialog
{
    Q_OBJECT

public:
    explicit RegisterDialog(QWidget *parent = nullptr);
    ~RegisterDialog();

private:
    void showTip(const QString& test, bool isOk);
    void initHandlers();

private slots:
    void on_pushButton_2_clicked();
    void on_pushButton_3_clicked();
    void slot_reg_mod_finish(QByteArray, ReqId, ErrorCodes);

    void on_pushButton_clicked();

private:
    Ui::RegisterDialog *ui;

    QQmlApplicationEngine *engine{nullptr};
    Tailor *tailor{nullptr};
    std::map<ReqId, std::function<void(const QJsonObject&)>> _handlers{};
};

#endif // REGISTERDIALOG_H
